﻿import QtQuick 2.0
import "../components"
import QtCharts 2.3
import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.2
import QtQuick.Controls 2.12
import QtMultimedia 5.14
Rectangle {
    width: parent.width
    height: parent.height
    property string xh:""
    property string gzdm: ""
    property string gzxx: ""
    property string mk: ""
    property bool isjxv: false
    property bool ispbv: false

    signal refre()

    onVisibleChanged: {
//        mod.setText(mk)
    }

    Row{
        anchors.fill: parent

        // 名称
        Text{
            id: num
            height: 40*dp;
            width: parent.width*0.1
            font.pixelSize: config.fontsize
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
            anchors.verticalCenter: parent.verticalCenter
            text: xh
        }
        CustomComboMultiBox{
            id: mod
            visible: true
            height: 40*dp;
            editWidth: parent.width*0.1
            anchors.verticalCenter: parent.verticalCenter
            editDefaultText:mk
            model: ["放靶","打靶","转靶","纯化"]
            onCheckChanged: {
                mk=mod.getText()
                CMaintenance.updateFaultInformation(mk,xh,gzxx,isjxv?"是":"否")
//                refre()
            }
        }

        // 名称
        Text{
            id: code
            height: 40*dp;
            width: parent.width*0.1
            font.pixelSize: config.fontsize
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
            anchors.verticalCenter: parent.verticalCenter
            text: gzdm
        }
        LineEditor{
            id: info
            visible: true
            height: 40*dp;
            editWidth: parent.width*0.4
            anchors.verticalCenter: parent.verticalCenter
            lengthVisible:false
            defaultText: gzxx
            onTextChanged: {
                gzxx=getText()
                CMaintenance.updateFaultInformation(mk,xh,gzxx,isjxv?"是":"否")
//                refre()
            }
        }

        // 是否默认
        Item{
            height: parent.height; width: parent.width*0.15
            CustomSwitchButton{
                height: 24*dp;  width: 40*dp
                anchors.centerIn: parent
                id: isjx
                checked: isjxv
                CustomTooltip{
                    visible: parent.isHovered
                    text: "是否继续"
                }
                onClicked: {
                    isjxv=!isjxv
                    CMaintenance.updateFaultInformation(mk,xh,gzxx,isjxv?"是":"否")
//                    refre()
                }

            }
        }
        // 操作
        Item{
            height: parent.height; width: parent.width*0.15
            CustomSwitchButton{
                height: 24*dp; width: 40*dp
                anchors.centerIn: parent
                id: ispb
                checked: ispbv
                CustomTooltip{
                    visible: parent.isHovered
                    text: "是否屏蔽"
                }
                onClicked: {
                    ispbv=!ispbv
                    CMaintenance.blockFaultInformation(xh,gzdm,ispbv?"是":"否")
//                    refre()
                }
            }
        }

    }
    Rectangle{
        x:0*dp
        y:parent.height-2*dp
        height: 1.2*dp
        width: parent.width
        color: "#DEDEDE"
    }



}
